#!/bin/sh
# -*- coding: utf-8 -*-
#Filename:   produce.sh
#Author:     Yaoyi
#Email:      yaoyi@zzvcom.com
#Date:       2019-05-02 18:08:52
#Desc:       

#set var
NAME=`basename $0`
dir=`pwd`
conf=${dir}/DIRCONFIG

#source func
source ${dir}/../source/common/functions.sh


function makemd5() {
	IFS=$'\n'
	for xpath in `cat $conf |grep -v ^#`
	do
		if [ X"${xpath}" = X ]
		then
			yaoecho hr "DIRCONFIG file have no content ! Please check it !"
			EchoErr ${LINENO}
			exit 1
		fi
		local what=`echo ${xpath}|awk -F "=" '{print $1}'`
		local where=`echo ${xpath}|awk -F "=" '{print $2}'`
		if [ X"${what}" = X ] || [ X"${where}" = X ]
		then
			yaoecho hr "DIRCONFIG file format error ! Please check it !"
			EchoErr ${LINENO}
			exit
		fi
		cd ${where}
		md5sum `find ./${what} -type f` >${dir}/../check/conf/"${what}".list
	done
}

makemd5

